package com.itinsys.enma.web;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.itinsys.enma.service.mail.MailService;

/***
 * 
 * @author sperez
 * 
 */
@Controller
@RequestMapping(value = "/mailTest")
public class MailTestFormController extends FormController{

	protected final Log logger = LogFactory.getLog("controller");
	
	@Autowired
	MailService mailService;
		
	@RequestMapping(method = RequestMethod.GET)
	protected void formBackingObject(HttpServletRequest request)
			throws ServletException {
	
	}
	
	@RequestMapping(value = "/sendMail/", method = RequestMethod.POST)
	public @ResponseBody boolean sendMail(@RequestBody String[] mailProps,HttpServletResponse response) {
		return mailService.sendMail(mailProps[0], mailProps[1], mailProps[2]);

	}


}
